
class A():
    def __init__(self, name, age):
        self.name = name
        self.age = age
class B():
    pass
a = A("zhangsan", 12)
print(a.name)
print(a.age)
b = 'name'
a.name = 'lisi'
a.age = 13
# 判断对象是否包含对应的属性
print(hasattr(a, b))
# 获取对象的指定属性
print(getattr(a, b))
# 设置对象的属性内容
setattr(a, b, 'zhangsan')
# 判断对象是否指定类型
print(isinstance(a, B))





